﻿/*****************************************************************//**
 * @file    FITKAcousticsVTKGraphObjectSEAFreeEdges.h
 * @brief   Graph object for SEA free edges data.
 *  
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-11-14
 *********************************************************************/

#ifndef __FITKACOUSTICSVTKGRAPHOBJECTSEAFEEEEDGES_H__
#define __FITKACOUSTICSVTKGRAPHOBJECTSEAFEEEEDGES_H__

#include "FITKAcousticsVTKGraphObject3D.h"

#include "FITKAcousticsVTKGraphAdaptorAPI.h"

// Forward declaration
class vtkUnstructuredGrid;

class FITKAcousticsVTKGraphActor;

namespace Acoustics
{
    class FITKAcousticsSEAModel;
}

namespace Exchange
{
    /**
     * @brief   Graph object for 'SEA free edges'.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-11-14
     */
    class FITKACOUSTICSGRAPHADAPTORAPI FITKAcousticsVTKGraphObjectSEAFreeEdges : public FITKAcousticsVTKGraphObject3D
    {
        // Regist
        FITKGraphObjectRegist(FITKAcousticsVTKGraphObjectSEAFreeEdges, FITKAcousticsVTKGraphObject3D);
        FITKCLASS(Exchange, FITKAcousticsVTKGraphObjectSEAFreeEdges);

    public:
        /**
         * @brief   Constructor.
         * @param   model: The SEA model data
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-14
         */
        FITKAcousticsVTKGraphObjectSEAFreeEdges(Acoustics::FITKAcousticsSEAModel* model);

        /**
         * @brief   Destructor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-14
         */
        ~FITKAcousticsVTKGraphObjectSEAFreeEdges();

        /**
         * @brief   Update all graph actors.[override]
         * @param   forceUpdate: Force update[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-14
         */
        void update(bool forceUpdate = false) override;

        /**
         * @brief   Update the visibility with data object's visibility.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-14
         */
        void updateVisibility() override;

    private:
        /**
         * @brief   Initialize.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-14
         */
        void init();

        /**
         * @brief   Generate the vtkDataSet for the sub-system.
         * @param   model: The SEA model data
         * @return  Is the data valid
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-14
         */
        bool generateDataSet(Acoustics::FITKAcousticsSEAModel* model);

        /**
         * @brief   Generate the actor with the sub-system data.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-14
         */
        void generateGraph();

    private:
        /**
         * @brief   The grid data for the SEA model's free edges.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-14
         */
        vtkUnstructuredGrid* m_ugrid{ nullptr };

        /**
         * @brief   The actor for the SEA model's free edges grid.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-14
         */
        FITKAcousticsVTKGraphActor* m_fActor{ nullptr };

    };
}   // namespace Exchange

#endif // __FITKACOUSTICSVTKGRAPHOBJECTSEAFEEEEDGES_H__
